<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/doc/src/q3ptrqueue.qdoc -->
<head>
  <title>Qt 4.3: Q3PtrQueue Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">Q3PtrQueue Class Reference<br /><sup><sup>[<a href="qt3support.html">Qt3Support</a> module]</sup></sup></h1>
<p>The Q3PtrQueue class is a template class that provides a queue. <a href="#details">More...</a></p>
<pre> #include &lt;Q3PtrQueue&gt;</pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See <a href="porting4.html">Porting to Qt 4</a> for more information.</p>
<p>Inherits <a href="q3ptrcollection.html">Q3PtrCollection</a>.</p>
<ul>
<li><a href="q3ptrqueue-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="q3ptrqueue.html#Q3PtrQueue">Q3PtrQueue</a></b> ()</li>
<li><div class="fn"/><b><a href="q3ptrqueue.html#Q3PtrQueue-2">Q3PtrQueue</a></b> ( const Q3PtrQueue&lt;type&gt; &amp; <i>queue</i> )</li>
<li><div class="fn"/><b><a href="q3ptrqueue.html#dtor.Q3PtrQueue">~Q3PtrQueue</a></b> ()</li>
<li><div class="fn"/>bool <b><a href="q3ptrqueue.html#autoDelete">autoDelete</a></b> () const</li>
<li><div class="fn"/>virtual void <b><a href="q3ptrqueue.html#clear">clear</a></b> ()</li>
<li><div class="fn"/>virtual uint <b><a href="q3ptrqueue.html#count">count</a></b> () const</li>
<li><div class="fn"/>type * <b><a href="q3ptrqueue.html#current">current</a></b> () const</li>
<li><div class="fn"/>type * <b><a href="q3ptrqueue.html#dequeue">dequeue</a></b> ()</li>
<li><div class="fn"/>void <b><a href="q3ptrqueue.html#enqueue">enqueue</a></b> ( const type * <i>d</i> )</li>
<li><div class="fn"/>type * <b><a href="q3ptrqueue.html#head">head</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="q3ptrqueue.html#isEmpty">isEmpty</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="q3ptrqueue.html#remove">remove</a></b> ()</li>
<li><div class="fn"/>void <b><a href="q3ptrqueue.html#setAutoDelete">setAutoDelete</a></b> ( bool <i>enable</i> )</li>
<li><div class="fn"/><b><a href="q3ptrqueue.html#operator-type--2a">operator type *</a></b> () const</li>
<li><div class="fn"/>Q3PtrQueue&lt;type&gt; &amp; <b><a href="q3ptrqueue.html#operator-eq">operator=</a></b> ( const Q3PtrQueue&lt;type&gt; &amp; <i>queue</i> )</li>
</ul>
<ul>
<li><div class="fn"/>4 public functions inherited from <a href="q3ptrcollection.html#public-functions">Q3PtrCollection</a></li>
</ul>
<a name="protected-functions"></a>
<h3>Protected Functions</h3>
<ul>
<li><div class="fn"/>virtual QDataStream &amp; <b><a href="q3ptrqueue.html#read">read</a></b> ( QDataStream &amp; <i>s</i>, Q3PtrCollection::Item &amp; <i>item</i> )</li>
<li><div class="fn"/>virtual QDataStream &amp; <b><a href="q3ptrqueue.html#write">write</a></b> ( QDataStream &amp; <i>s</i>, Q3PtrCollection::Item <i>item</i> ) const</li>
</ul>
<ul>
<li><div class="fn"/>2 protected functions inherited from <a href="q3ptrcollection.html#protected-functions">Q3PtrCollection</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The Q3PtrQueue class is a template class that provides a queue.</p>
<p><a href="q3valuevector.html">Q3ValueVector</a> can be used as an STL-compatible alternative to this class.</p>
<p>A template instance Q3PtrQueue&lt;X&gt; is a queue that operates on pointers to X (X*).</p>
<p>A queue is a first in, first out structure. Items are added to the tail of the queue with <a href="q3ptrqueue.html#enqueue">enqueue</a>() and retrieved from the head with <a href="q3ptrqueue.html#dequeue">dequeue</a>(). You can peek at the head item without dequeing it using <a href="q3ptrqueue.html#head">head</a>().</p>
<p>You can control the queue's deletion policy with <a href="q3ptrqueue.html#setAutoDelete">setAutoDelete</a>().</p>
<p>For compatibility with the <a href="q3ptrcollection.html">Q3PtrCollection</a> classes, <a href="q3ptrqueue.html#current">current</a>() and <a href="q3ptrqueue.html#remove">remove</a>() are provided; both operate on the <a href="q3ptrqueue.html#head">head</a>().</p>
<p>See also <a href="q3ptrlist.html">Q3PtrList</a> and <a href="q3ptrstack.html">Q3PtrStack</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="Q3PtrQueue"></a>Q3PtrQueue::Q3PtrQueue ()</h3>
<p>Creates an empty queue with <a href="q3ptrqueue.html#autoDelete">autoDelete</a>() set to FALSE.</p>
<h3 class="fn"><a name="Q3PtrQueue-2"></a>Q3PtrQueue::Q3PtrQueue ( const Q3PtrQueue&lt;type&gt; &amp; <i>queue</i> )</h3>
<p>Creates a queue from <i>queue</i>.</p>
<p>Only the pointers are copied; the items are not. The <a href="q3ptrqueue.html#autoDelete">autoDelete</a>() flag is set to FALSE.</p>
<h3 class="fn"><a name="dtor.Q3PtrQueue"></a>Q3PtrQueue::~Q3PtrQueue ()</h3>
<p>Destroys the queue. Items in the queue are deleted if <a href="q3ptrqueue.html#autoDelete">autoDelete</a>() is TRUE.</p>
<h3 class="fn"><a name="autoDelete"></a>bool Q3PtrQueue::autoDelete () const</h3>
<p>Returns the setting of the auto-delete option. The default is FALSE.</p>
<p>See also <a href="q3ptrqueue.html#setAutoDelete">setAutoDelete</a>().</p>
<h3 class="fn"><a name="clear"></a>void Q3PtrQueue::clear ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Removes all items from the queue, and deletes them if <a href="q3ptrqueue.html#autoDelete">autoDelete</a>() is TRUE.</p>
<p>Reimplemented from <a href="q3ptrcollection.html#clear">Q3PtrCollection</a>.</p>
<p>See also <a href="q3ptrqueue.html#remove">remove</a>().</p>
<h3 class="fn"><a name="count"></a><a href="qtglobal.html#uint-typedef">uint</a> Q3PtrQueue::count () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Returns the number of items in the queue.</p>
<p>Reimplemented from <a href="q3ptrcollection.html#count">Q3PtrCollection</a>.</p>
<p>See also <a href="q3ptrqueue.html#isEmpty">isEmpty</a>().</p>
<h3 class="fn"><a name="current"></a>type * Q3PtrQueue::current () const</h3>
<p>Returns a pointer to the head item in the queue. The queue is not changed. Returns 0 if the queue is empty.</p>
<p>See also <a href="q3ptrqueue.html#dequeue">dequeue</a>() and <a href="q3ptrqueue.html#isEmpty">isEmpty</a>().</p>
<h3 class="fn"><a name="dequeue"></a>type * Q3PtrQueue::dequeue ()</h3>
<p>Takes the head item from the queue and returns a pointer to it. Returns 0 if the queue is empty.</p>
<p>See also <a href="q3ptrqueue.html#enqueue">enqueue</a>() and <a href="q3ptrqueue.html#count">count</a>().</p>
<h3 class="fn"><a name="enqueue"></a>void Q3PtrQueue::enqueue ( const type * <i>d</i> )</h3>
<p>Adds item <i>d</i> to the tail of the queue.</p>
<p>See also <a href="q3ptrqueue.html#count">count</a>() and <a href="q3ptrqueue.html#dequeue">dequeue</a>().</p>
<h3 class="fn"><a name="head"></a>type * Q3PtrQueue::head () const</h3>
<p>Returns a pointer to the head item in the queue. The queue is not changed. Returns 0 if the queue is empty.</p>
<p>See also <a href="q3ptrqueue.html#dequeue">dequeue</a>() and <a href="q3ptrqueue.html#isEmpty">isEmpty</a>().</p>
<h3 class="fn"><a name="isEmpty"></a>bool Q3PtrQueue::isEmpty () const</h3>
<p>Returns TRUE if the queue is empty; otherwise returns FALSE.</p>
<p>See also <a href="q3ptrqueue.html#count">count</a>(), <a href="q3ptrqueue.html#dequeue">dequeue</a>(), and <a href="q3ptrqueue.html#head">head</a>().</p>
<h3 class="fn"><a name="read"></a><a href="qdatastream.html">QDataStream</a> &amp; Q3PtrQueue::read ( <a href="qdatastream.html">QDataStream</a> &amp; <i>s</i>, <a href="q3ptrcollection.html#Item-typedef">Q3PtrCollection::Item</a> &amp; <i>item</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Reads a queue item, <i>item</i>, from the stream <i>s</i> and returns a reference to the stream.</p>
<p>The default implementation sets <i>item</i> to 0.</p>
<p>See also <a href="q3ptrqueue.html#write">write</a>().</p>
<h3 class="fn"><a name="remove"></a>bool Q3PtrQueue::remove ()</h3>
<p>Removes the head item from the queue, and returns TRUE if there was an item, i.e&#x2e; the queue wasn't empty; otherwise returns FALSE.</p>
<p>The item is deleted if <a href="q3ptrqueue.html#autoDelete">autoDelete</a>() is TRUE.</p>
<p>See also <a href="q3ptrqueue.html#head">head</a>(), <a href="q3ptrqueue.html#isEmpty">isEmpty</a>(), and <a href="q3ptrqueue.html#dequeue">dequeue</a>().</p>
<h3 class="fn"><a name="setAutoDelete"></a>void Q3PtrQueue::setAutoDelete ( bool <i>enable</i> )</h3>
<p>Sets the queue to auto-delete its contents if <i>enable</i> is TRUE and not to delete them if <i>enable</i> is FALSE.</p>
<p>If auto-deleting is turned on, all the items in a queue are deleted when the queue itself is deleted. This can be quite convenient if the queue has the only pointer to the items.</p>
<p>The default setting is FALSE, for safety. If you turn it on, be careful about copying the queue: you might find yourself with two queues deleting the same items.</p>
<p>See also <a href="q3ptrqueue.html#autoDelete">autoDelete</a>().</p>
<h3 class="fn"><a name="write"></a><a href="qdatastream.html">QDataStream</a> &amp; Q3PtrQueue::write ( <a href="qdatastream.html">QDataStream</a> &amp; <i>s</i>, <a href="q3ptrcollection.html#Item-typedef">Q3PtrCollection::Item</a> <i>item</i> ) const&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Writes a queue item, <i>item</i>, to the stream <i>s</i> and returns a reference to the stream.</p>
<p>The default implementation does nothing.</p>
<p>See also <a href="q3ptrqueue.html#read">read</a>().</p>
<h3 class="fn"><a name="operator-type--2a"></a>Q3PtrQueue::operator type * () const</h3>
<p>Returns a pointer to the head item in the queue. The queue is not changed. Returns 0 if the queue is empty.</p>
<p>See also <a href="q3ptrqueue.html#dequeue">dequeue</a>() and <a href="q3ptrqueue.html#isEmpty">isEmpty</a>().</p>
<h3 class="fn"><a name="operator-eq"></a>Q3PtrQueue&lt;type&gt; &amp; Q3PtrQueue::operator= ( const Q3PtrQueue&lt;type&gt; &amp; <i>queue</i> )</h3>
<p>Assigns <i>queue</i> to this queue and returns a reference to this queue.</p>
<p>This queue is first cleared and then each item in <i>queue</i> is enqueued to this queue. Only the pointers are copied.</p>
<p><b>Warning:</b> The <a href="q3ptrqueue.html#autoDelete">autoDelete</a>() flag is not modified. If it is TRUE for both <i>queue</i> and this queue, deleting the two lists will cause <i>double-deletion</i> of the items.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
